home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Proxies
/
SimpleProxy.h
< prev
next >
Wrap
Text File
|
1997-06-28
|
820b
|
49 lines
// SimpleProxy.h
#ifndef SimpleProxy_h
#define SimpleProxy_h
#ifndef Proxy_h
#include "Proxy.h"
#endif
#ifndef Assert_h
#include "Assert.h"
#endif
template < class OwnerType, class StoodFor >
class SimpleProxy: public Proxy< StoodFor >
{
typedef OwnerType Owner;
typedef StoodFor (Owner::*Getter)() const;
typedef void (Owner::*Setter)( StoodFor ) const;
private:
const Owner& owner;
const Getter get;
const Setter set;
public:
SimpleProxy( const Owner& theOwner,
Getter getter,
Setter setter )
: owner( theOwner ),
get( getter ),
set( setter )
{
Assert( getter != 0 );
Assert( setter != 0 );
}
virtual StoodFor Get() const
{
return (owner.*get)();
}
virtual void Set( StoodFor value )
{
(owner.*set)( value );
}
};
#endif